<style lang="less" scoped src="./member.less"></style>
<script src="./member.js"></script>

<template>
    <div>
        <Row style="font-size: 15px;">
            <Col span="22">
            姓名：<Input v-model="query.realname" clearable style="width: 15%"></Input>
            电话：<Input v-model="query.phone" clearable style="width: 15%"></Input>
            <span @click="loadList"><Button type="primary" icon="android-search">查询</Button></span>
            <span @click="refresh"><Button type="primary" icon="refresh">清空</Button></span>
            </Col>
            <Col span="2">
                <span @click="showAdd"><Button type="primary" icon="android-add">新增</Button></span>
            <!--Row>
                <Col span="24">
                    <span @click="showAdd"><Button type="primary" icon="android-add">新增</Button></span>
                </Col>
                <Col span="10">
                    <a :href="downloadUrl"><Button type="primary" icon="ios-cloud-download">下载导入模板</Button></a>
                </Col>
                <Col span="8">
                    <Upload :action="SERVER_HOST + 'busine/member/memberImport/?orgId=' + baseuser.orgId"
                            :show-upload-list="false"
                            :on-success="handleSuccess">
                        <Button type="primary" icon="ios-cloud-upload">导入会员</Button>
                    </Upload>
                </Col>
            </Row-->
            </Col>
        </Row>
        <div class="main-table">
            <Table border :columns="columns" :data="data"></Table>
        </div>
        <div class="pagination">
            <Page :total="total" size="small" :page-size="pageSize" :current.sync="pageIndex" @on-change="loadList"
                  show-total show-elevator></Page>
        </div>
        <Modal v-model="editModal"
               :title="(formData.id ? '修改': '新增') + '会员'"
               width="40%"
               :mask-closable="false"
               @on-cancel="editModal = false">
            <Form :model="formData" :label-width="120">
                <FormItem label="会员名称">
                    <Input v-model="formData.realname" clearable></Input>
                </FormItem>
                <FormItem label="联系电话">
                    <Input v-model="formData.phone" clearable></Input>
                </FormItem>
                <FormItem label="性别">
                    <Select v-model="formData.sex" clearable style="width: 100%">
                        <Option :value=1>男</Option>
                        <Option :value=2>女</Option>
                    </Select>
                </FormItem>
                <FormItem label="年龄">
                    <InputNumber v-model="formData.age"
                                 :min="0"
                                 :precision="0"
                                 style="width: 100%"
                    ></InputNumber>
                </FormItem>
                <FormItem label="学校/所在单位">
                    <Input v-model="formData.school" clearable></Input>
                </FormItem>
            </Form>
            <div slot="footer">
                <Button type="primary" @click="save">保存</Button>
                <Button type="ghost" style="margin-left: 8px" @click="editModal = false">取消</Button>
            </div>
        </Modal>
        <Modal v-model="prizesModal"
               title="我的奖状"
               width="60%"
               :mask-closable="false"
               @on-cancel="prizesModal = false">
            <div class="main-table">
                <Table border :columns="prizesColumns" :data="prizesData"></Table>
            </div>
            <div class="pagination">
                <Page :total="prizesTotal" size="small" :page-size="prizesSize" :current.sync="prizesIndex" @on-change="prizesSelect"
                      show-total show-elevator></Page>
            </div>
        </Modal>
        <Modal v-model="prizeModal"
               title="奖状"
               @on-cancel="prizeModal = false">
            <img :src="imgpath" width="100%">
        </Modal>
    </div>
</template>